package com.carbeauty.common.enums;

/**
 * 订单状态枚举
 * 
 * @author CarBeauty Team
 */
public enum OrderStatus {
    
    /**
     * 待确认
     */
    PENDING("PENDING", "待确认", "订单已创建，等待确认"),
    
    /**
     * 已确认
     */
    CONFIRMED("CONFIRMED", "已确认", "订单已确认，准备服务"),
    
    /**
     * 服务中
     */
    IN_PROGRESS("IN_PROGRESS", "服务中", "正在提供服务"),
    
    /**
     * 已完成
     */
    COMPLETED("COMPLETED", "已完成", "服务已完成"),
    
    /**
     * 已取消
     */
    CANCELLED("CANCELLED", "已取消", "订单已取消"),
    
    /**
     * 已退款
     */
    REFUNDED("REFUNDED", "已退款", "订单已退款");
    
    private final String code;
    private final String name;
    private final String description;
    
    OrderStatus(String code, String name, String description) {
        this.code = code;
        this.name = name;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getName() {
        return name;
    }
    
    public String getDescription() {
        return description;
    }
    
    public static OrderStatus fromCode(String code) {
        for (OrderStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("未知的订单状态代码: " + code);
    }
}
